<?php
namespace Home\Controller;
use Think\Controller;
class ShopingController extends Controller {
    public function lists(){
		$name = session('name');
		$datas = M('shoping')->where("user='$name'")->select();
		foreach($datas as $k=>$v){
			$datas[$k]['number'] = (int)$v['number'];
			$datas[$k]['status'] = (int)$v['status'];
		}
		
		$this->assign("k",CONTROLLER_NAME);
		$this->assign("f",ACTION_NAME);
		$this->assign('name',$name);
		$this->assign('datas',$datas);
		$this->display(); 
    }
	public function listsinfo(){
		$id = $_GET['uid'];
		$reslists = M('listinfo')->where("id='$id'")->select();
		$name = session('name');
		$data['price']=$reslists[0]['price'];
		$data['name']=$reslists[0]['title'];
		$data['user']=$name;
		$res = M('shoping');
		$res->add($data);
		$this->redirect("shoping/lists");
	}
	public function del(){
		$id = $_GET['uid'];
		$res = M("shoping")->where("id='$id'")->delete();
		$this->redirect("shoping/lists");
	}
}